import request from '@/utils/request.js'



// 查询质押记录
export const MinerspledgeRecords = (address) => {
  return request({
    url: `/Miners/pledgeRecords?address=${address}`,
    method: 'get'
  })
}
// 构建质押交易
export const MinerspledgeTransaction = (data) => {
  return request({
    url: `/Miners/pledgeTransaction`,
    method: 'post',
    data
  })
}
// 保存质押交易
export const Minerspledge = (data) => {
  return request({
    url: `/Miners/pledge`,
    method: 'post',
    data
  })
}


// 构建邀请码交易
export const inviteCodetransaction = (data) => {
  return request({
    url: `/inviteCode/transaction`,
    method: 'post',
    data
  })
}
/* 邀请码价格和购买数量 */
export const inviteCodeinfo = ({ role, address }) => {
  return request({
    url: `/inviteCode/info/${address}/${role}`,
    method: 'get'
  })
}

/* 购买邀请码 */
export const inviteCodepurchase = (data) => {
  return request({
    url: `/inviteCode/purchase`,
    method: 'post',
    data
  })
}
/* 邀请码历史记录 */
export const inviteCodehistory = ({ address }) => {
  return request({
    url: `/inviteCode/history?address=${address}`,
    method: 'get',
  })
}





// 保存記錄
export const airdroprewards = (data) => {
  return request({
    url: `/airdrop/rewards`,
    method: 'post',
    data
  })
}
// 空投信息
export const airdropinfo = (address) => {
  return request({
    url: `/airdrop/info?address=${address}`,
    method: 'get',
  })
}
// 空投交易
export const airdroptransaction = (data) => {
  return request({
    url: `/airdrop/transaction`,
    method: 'post',
    data
  })
}





/* 兌換比例 */
export const icoratio = () => {
  return request({
    url: `/ico/ratio`,
    method: 'get',
  })
}

/* 兌換 */
export const icoexchange = (data) => {
  return request({
    url: `/ico/exchange`,
    method: 'post',
    data
  })
}

// sol兌換代幣记录
export const icoexchangehistory = (address) => {
  return request({
    url: `/ico/exchange/history?address=${address}`,
    method: 'get',
  })
}

// ico构建交易
export const icotransaction = (data) => {
  return request({
    url: `/ico/transaction`,
    method: 'post',
    data
  })
}


// 检查更新
export const checkForUpdate = (data) => {
  return request({
    url: `http://8.155.13.166:3001/checkForUpdate/1.0.0`,
    method: 'post',
    data
  })
}


// 解密签名
export const authDecryptSign = (data) => {
  return request({
    url: `/auth/decryptSign`,
    method: 'post',
    data
  })
}

// 生成签名
export const authGetSign = (data) => {
  return request({
    url: `/auth/getSign`,
    method: 'post',
    data
  })
}


// 解密钱包地址
export const authDecrypt = (data) => {
  return request({
    url: `/auth/decrypt`,
    method: 'post',
    data
  })
}

// // 获取密钥
export const authDeeplink = () => {
  return request({
    url: `/auth/deeplink`,
    method: 'get'
  })
}



/* 钱包登录 */
export const login = (walletData) => {
  return request({
    url: '/auth/login',
    method: 'post',
    data: walletData,
  })
}


// 释放Vesting收益
export const setgetReleaseData = (data) => {
  return request({
    url: `/vesting/getRelease`,
    method: 'post',
    data
  })
}


/* 查询阶段信息 */
export const getStagesInfo = () => {
  return request({
    url: '/stages/current-and-next',
    method: 'get',
  })
}

/* claim 信息 */
export const vestingbeneficiary = (walletAddress) => {
  return request({
    url: `/vesting/beneficiary/${walletAddress}`,
    method: 'get',
  })
}

/* 查询算力挖矿奖励 */
export const getMiningRewards = ({ address }) => {
  return request({
    url: `/Miners/rewards?address=${address}`,
    method: 'get',
  })
}





/* 获取奖励 */
export const getHoldersRewards = (address) => {
  return request({
    url: `/holders/rewards?address=${address}`,
    method: 'get',
  })
}

/* top 10 */
export const holderstop = (address) => {
  return request({
    url: `/holders/top-holders`,
    method: 'get',
  })
}





/* 获取用户信息 */
export const getUserInfo = (address) => {
  return request({
    url: `/users/info?address=${address}`,
    method: 'get',
  })
}

/* 绑定邀请码 */
export const bindInviteCode = (data) => {
  return request({
    url: '/users/bindInviteCode',
    method: 'post',
    data
  })
}

/* 获取交易记录 */
export const getTransactionsList = ({ address, type }) => {
  // console.log(type, "type");
  return request({
    url: `/transactions/list?address=${address}&type=${type}`,
    method: 'get',
  })
}